<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Echarts</title>
    <script src="/js/echarts.common.min.js"></script>
</head>
<body>

<div id="main" style="width: 600px;height:400px;"></div>
<script type="text/javascript">
    // 基于准备好的dom，初始化echarts实例
    var myChart = echarts.init(document.getElementById('main'));

    // 指定图表的配置项和数据
    var option = {
        title: {
            text: '商品类目销售分析',
            subtext: '这是个例子',
            left: 'center'
        },
        tooltip: {
            trigger: 'item',
            formatter: '{a} <br/>{b} : {c} ({d}%)'
        },
        legend: {
            orient: 'vertical',
            left: 'left',
            data: ['水果', '蔬菜', '家电', '数码', '服装']
        },
        series: [
            {
                name: '销售量',
                type: 'pie',
                radius: '50%',
                center: ['30%', '50%'],
                data: [
                    {value: 335, name: '水果'},
                    {value: 310, name: '蔬菜'},
                    {value: 234, name: '家电'},
                    {value: 135, name: '数码'},
                    {value: 1548, name: '服装'}
                ],
                emphasis: {
                    itemStyle: {
                        shadowBlur: 100,
                        shadowOffsetX: 10,
                        shadowColor: 'rgba(0, 0, 0, 0.5)'
                    }
                }
            },

            {
                name: '销售额',
                type: 'pie',
                radius: '50%',
                center: ['80%', '50%'],
                data: [
                    {value: 1000, name: '水果'},
                    {value: 2000, name: '蔬菜'},
                    {value: 3000, name: '家电'},
                    {value: 3000, name: '数码'},
                    {value: 2000, name: '服装'}
                ],
                emphasis: {
                    itemStyle: {
                        shadowBlur: 100,
                        shadowOffsetX: 10,
                        shadowColor: 'rgba(0, 0, 0, 0.5)'
                    }
                }
            }
        ],
    };


    // 使用刚指定的配置项和数据显示图表。
    myChart.setOption(option);
</script>


</body>
</html>